<template>
  <div>
    <detail-nav-bar></detail-nav-bar>
    <detail-swiper :swiperImage="topImage"></detail-swiper>
    <detail-base-info :goodsInfo="goods"></detail-base-info>
  </div>
</template>

<script>
import DetailNavBar from './childComps/DetailNavBar.vue'
import DetailSwiper from './childComps/DetailSwiper.vue'
import DetailBaseInfo from './childComps/DetailBaseInfo.vue'

import {getDetail, Goods} from 'network/detail'

export default {
  name: "Detail",
  components: {
    DetailNavBar,
    DetailSwiper,
    DetailBaseInfo
  },
  data(){
    return {
      iid: '',
      topImage: [],
      goods: {}
    }
  },
  created(){
    this.iid = this.$route.params.iid
    getDetail(this.iid).then(res => {
      const data = res.result
      this.topImage = data.itemInfo.topImages
      // console.log(this.topImage);
      this.goods = new Goods(data.itemInfo, data.columns, data.shopInfo.services)
    })
  }
}
</script>

<style>

</style>